//
//  ViewController.m
//  28-AutoLayoutAnimation
//
//  Created by 鹏飞罗 on 16/8/22.
//  Copyright © 2016年 罗鹏飞. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *centY;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutLeft20;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutLeft150;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
}

- (IBAction)startAnimation:(UIButton *)sender {
//   //  改变centerY 的 constant
    self.centY.constant = 200;
//
//    [UIView animateWithDuration:5 animations:^{
////         必须调用 layoutIfNeeded
//      [self.view layoutIfNeeded];
//           }];
//    约束的优先集， 改变时， 需要注意不能为1000，程序会崩溃
//    同一约束 优先级高的会被执行， 优先级低的会被忽略
    self.layoutLeft20.priority = 751;
    self.layoutLeft150.priority = 750;
    [UIView animateWithDuration:5 animations:^{
        [self.view layoutIfNeeded];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
